package cn.com.gt3.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.com.gt3.entity.DmQxSwrysfEntity;
import cn.com.gt3.mapper.DmQxSwrysfMapper;
import cn.com.gt3.service.DmQxSwrysfService;

@Service
public class DmQxSwrysfServiceImpl extends ServiceImpl<DmQxSwrysfMapper, DmQxSwrysfEntity>
		implements DmQxSwrysfService {

	@Override
	public List<DmQxSwrysfEntity> getUserIdentityById(String userId) {

		LambdaQueryWrapper<DmQxSwrysfEntity> lambdaQuery = Wrappers.lambdaQuery();
		List<DmQxSwrysfEntity> list = this
				.list(lambdaQuery.eq(DmQxSwrysfEntity::getSwryDm, userId).eq(DmQxSwrysfEntity::getYxbz, "Y")
						.eq(DmQxSwrysfEntity::getZsfbz, "Y").orderByDesc(DmQxSwrysfEntity::getSwrysfDm));
		
		return list;
	}

	@Override
	public DmQxSwrysfEntity getUserIdentityByIdentity(String identity) {
		return this.getById(identity);
	}
	
	@Override
	public List<DmQxSwrysfEntity> getUserIdentityByIdentityAndTaxorgcode(String identity,String taxorgcode) {
		
		LambdaQueryWrapper<DmQxSwrysfEntity> lambdaQuery = Wrappers.lambdaQuery();
		
		List<DmQxSwrysfEntity> list = this
				.list(lambdaQuery.eq(DmQxSwrysfEntity::getSwrysfDm, identity).eq(DmQxSwrysfEntity::getYxbz, "Y")
						.eq(DmQxSwrysfEntity::getSfswjgDm, taxorgcode));
		
		return list;
		
	}

	@Override
	public List<DmQxSwrysfEntity> getByUserId(String userId) {
		LambdaQueryWrapper<DmQxSwrysfEntity> lambdaQuery = Wrappers.lambdaQuery();
		List<DmQxSwrysfEntity> list = this
				.list(lambdaQuery.eq(DmQxSwrysfEntity::getSwryDm, userId).eq(DmQxSwrysfEntity::getYxbz, "Y"));
		return list;
	}

	
}
